from __future__ import with_statement
from es import getAddonPath
from re import compile as rcompile
from os.path import join

# Thanks to Docky.
regex = rcompile('//.*|(\r|\n|")+')

def readData(fileName):
    with open(join(getAddonPath('superdice'), 'data', fileName + '.txt'), 'rb') as fileObject:
        dataSet = []
        for line in fileObject.readlines():
            line = regex.sub('', line).strip()
            if not line:
                continue

            dataSet.append(line)

        return dataSet
